import 'package:bp_alicloud_push/bp_alicloud_push.dart';
import 'package:bp_alicloud_push/bp_alicloud_push_method_channel.dart';
import 'package:bp_alicloud_push/bp_alicloud_push_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockBpAlicloudPushPlatform
    with MockPlatformInterfaceMixin
    implements BpAlicloudPushPlatform {
  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<bool?> bindAccount(String account) => Future.value(true);

  @override
  Future<bool?> unbindAccount() => Future.value(true);

  @override
  void listenerEvent(Function(dynamic data) onData) {}

  @override
  void receiver(Function(dynamic data) onData) {}
}

void main() {
  final BpAlicloudPushPlatform initialPlatform =
      BpAlicloudPushPlatform.instance;

  test('$MethodChannelBpAlicloudPush is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelBpAlicloudPush>());
  });

  test('getPlatformVersion', () async {
    BpAlicloudPush bpAlicloudPushPlugin = BpAlicloudPush();
    MockBpAlicloudPushPlatform fakePlatform = MockBpAlicloudPushPlatform();
    BpAlicloudPushPlatform.instance = fakePlatform;

    expect(await bpAlicloudPushPlugin.getPlatformVersion(), '42');
  });
}
